%The function gonna return the boundingBox of the blob.

%mapImgFilename - filename of the black and white picture.
function boundingBox = foundBoundingBox(mapImgFilename)

mapImgTemp = imread(mapImgFilename);    %This picture SHOULD be black and white, one channel.

mapImg = mapImgTemp(:,:,1);

m = size(mapImg,1); %height
n = size(mapImg,2); %width

mapImgBin = gray2bin(mapImg,'qam',256);

[y x] = ind2sub(size(mapImgBin),find(mapImgBin~=0));

boundingBox = [min(x) min(y); max(x) max(y)];